<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Class 与 Style 绑定</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
    <div id="example"
        class="static"
        v-bind:class="{ active: isActive, 'text-danger': hasError }"
    ></div>

    <div id="example1" v-bind:class="classObject"></div>

    <div id="example3" v-bind:class="[activeClass, errorClass]"></div>
</body>
    <script>
      var vm = new Vue({
            el: '#example',
            data: {
                isActive: true,
                hasError: false
            }
        })

        var vm = new Vue({
            el: '#example1',
            data: {
                classObject: {
                    active: true,
                    'text-danger': false
                }
            }
        })

        var vm = new Vue({
            el: '#example3',
            data: {
                activeClass: 'active',
                errorClass: 'text-danger'
            }
        })
    </script>
</html>